package ruifeng.zcj.dig.ui.forum;

import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;

import com.lidroid.xutils.exception.HttpException;
import com.lidroid.xutils.http.ResponseInfo;
import com.lidroid.xutils.http.callback.RequestCallBack;

import java.util.ArrayList;
import java.util.List;

import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewAdapter;
import cn.bingoogolapple.androidcommon.adapter.BGARecyclerViewHolder;
import cn.bingoogolapple.androidcommon.adapter.BGAViewHolderHelper;
import ruifeng.zcj.dig.R;
import ruifeng.zcj.dig.base.api.OSChinaApi;
import ruifeng.zcj.dig.groble.FragmentArgs;
import ruifeng.zcj.dig.groble.ToActivityUtil;
import ruifeng.zcj.dig.ui.base.RefreshRecyclerFragment;
import ruifeng.zcj.dig.ui.forum.base.BasePostFragment;
import ruifeng.zcj.dig.ui.forum.bean.NewPost;
import ruifeng.zcj.dig.ui.shopping.ShoppingActivity;
import ruifeng.zcj.dig.ui.shopping.bean.Category;
import ruifeng.zcj.mybase.base.utils2.AbJsonUtil;

/**
 * 最新帖子信息
 * Created by Administrator on 2016/9/23 0023.
 */
public class NewPostFragment extends BasePostFragment {

    @Override
    protected void onFirstUserVisible() {
        OSChinaApi.getpostingslist("0", null, null, "1", "10", new RequestCallBack<String>() {
            @Override
            public void onSuccess(ResponseInfo<String> responseInfo) {
                if (!TextUtils.isEmpty(responseInfo.result)) {
                    mNewPost = (NewPost) AbJsonUtil.fromJson(responseInfo.result, NewPost.class);
                    mMomentAdapter.addNewData(mNewPost.getRows());
                }
            }

            @Override
            public void onFailure(HttpException e, String s) {
                showSnackBar("日志:" + s);
            }

        });
    }

}
